Title: Icon to Bitmap Converter (ICO2BMP) Author: Philip J. Erdelsky, 75746.3411@compuserve.com Language: Turbo C/C++ 3.1 for DOS Platform DOS Portability: Other DOS or UNIX C++ compilers, with slight changes Restrictions: Public domain, no restrictions on use Date: January 10, 1995 Keywords: Icon, Bitmap Abstract: A simple DOS utility to convert a Windows icon (.ICO) file into a Windows bitmap (.BMP) file. A Windows bitmap is suitable is some situations where a Windows icon is not. ICO2BMP converts a Windows icon file (with extension .ICO) into a Windows bitmap file (with extension .BMP), or a Windows bitmap resource (with extension .RC), retaining as much of the original information as possible. If you want to convert an icon file into a bitmap file with the same name, and you are willing to accept the default values of most parameters, a command line of the following form will suffice: ICO2BMP MYICON ICO2BMP will convert the icon file MYICON.ICO (which may contain only one icon) to the bitmap file MYICO.BMP. For more complex conversions, ICO2BMP is called up by a command line of the following form: ICO2BMP icon [-i n] [-b bitmap] [-n name] [-a] [-c red green blue] [-v] icon icon file specifications n index number of icon to be converted (first is number 0) bitmap bitmap file specifications -a append bitmap to existing bitmap file name bitmap name red red intensity of background (0-255) green green intensity of background (0-255) blue blue intensity of background (0-255) -v verbose output for diagnostic purposes The icon file specifications must be given. If there is no extension, .ICO is appended. If there is an extension, it must be .ICO. The icon file specifications must appear first; the options may appear in any order. If the icon file contains more than one icon, you must specify the index number of the icon to be converted. The index number of the first icon is zero. If the bitmap file specifications are omitted, the icon file specifications are used, with the extension changed to .BMP. If the bitmap file specifications are given without an extension, .BMP is appended. If the bitmap file specifications are given with an extension, it must be either .BMP or .RC. If the bitmap file extension is .BMP, a bitmap file is generated. If the bitmap file extension is .RC, a Resource Compiler source file is generated, in text form. When the bitmap file extension is .RC, the -a option causes the generated text to be appended to an existing Resource Compiler source file. When the bitmap file extension is .RC, the bitmap must have a name. If you specify a name containing an exclamation point (!), the file name of the icon file is subsituted for the exclamation point. If you do not specify a name, the name is constructed by appending the icon file name to BITMAP_. In some cases, you may wish to specify the red, green and blue intensities of the background color. An icon may contain transparent regions where the background shows through, and other regions where the background is complemented. If red = green = blue = 0, the background is black. If red = green = blue = 255, the background is white. Intermediate intensities give backgrounds of various colors. If you do not specify a background color, ICO2BMP uses red = green = blue = 192, which is a light gray color, for most icons. For a two-color (black and white) icon, however, it uses a white background. Although they do not appear in icons generated by the Borland Resource Workshop, the icon file format permits an icon to have regions where the background is partly complemented. ICO2BMP follows the rules in such cases, producing partly complemented versions of the background color. An icon may use 2, 8 or 16 colors. ICO2BMP generates a bitmap which uses the same colors. If the icon contains transparent or complemented regions, some parts of the bitmap may contain colors not in the original icon, especially if the background color is not among the colors used in the icon. In these cases, ICO2BMP chooses colors from the icon colors that most closely match the background color or complemented background color. For the sake of efficiency, you should not create 8-color icons, since they occupy the same amount of space as 16-color icons and are converted into 16-color bitmaps.